﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Security;

namespace Mortgage.Srv
{
    public interface ICredentialsSrv
    {
        MembershipUserCollection GetMemberShip(int idx, int numOfPage);
        int GetTotalUsers();
        MembershipUser GetMemberShipById(string userName);
    }
    public class CredentialsSrv : ICredentialsSrv
    {
        const int PAGE_SIZE = 50;
        public MembershipUserCollection GetMemberShip(int idx, int numOfPage)
        {
            int totalUser = 0;
            return Membership.GetAllUsers(idx, numOfPage, out totalUser);
        }
        public int GetTotalUsers()
        {
            int idx = 0, numOfPage = PAGE_SIZE;
            int totalUser = 0;
            Membership.GetAllUsers(idx, numOfPage, out totalUser);
            return totalUser;
        }


        public MembershipUser GetMemberShipById(string userName)
        {
            MembershipUser result = Membership.GetUser(userName);
            return result;
        }

    }
}
